#ifndef _IVNCSERVER_H_
#define _IVNCSERVER_H_

#include "ISocket.h"
#include "IVNCClient.h"
#include "IVNCDesktop.h"
#include "rfbUpdateTracker.h"

typedef std::list<unsigned short> vncClientList;
enum AcceptQueryReject {aqrAccept, aqrQuery, aqrReject};

struct _declspec(novtable) IVNCServer
{
    virtual unsigned short AddClient( ISocket* socket, bool bAuth, bool bShared ) = 0;
	virtual unsigned short AddClient( ISocket* socket, bool bAuth, bool bShared,char* protocolMsg ) = 0;
	virtual unsigned short AddClient( ISocket* socket, bool bAuth, bool bShared,int nCapability,char* protocolMsg ) = 0;
	virtual bool Authenticated( unsigned short uClientId ) = 0;
	virtual void KillClient( unsigned short uClientId ) = 0;
	virtual void KillClient( char* szClientName ) = 0;
	virtual void TextChatClient( char* szClientName ) = 0;
	virtual unsigned int AuthClientCount() = 0;
	virtual unsigned int UnauthClientCount() = 0;
	virtual void KillAuthClients() = 0;
	virtual void WaitUntilAuthEmpty() = 0;
	virtual void KillUnauthClients() = 0;
	virtual void WaitUntilUnauthEmpty() = 0;
	virtual bool UpdateWanted() = 0;
	virtual bool RemoteEventReceived() = 0;

	virtual IVNCClient* GetClient( unsigned short uClientId ) = 0;
	virtual vncClientList ClientList() = 0;

	virtual void SetCapability( unsigned short uClientId , int nCapability ) = 0;
	virtual void SetKeyboardEnabled( unsigned short uClientId , bool bEnabled ) = 0;
	virtual void SetPointerEnabled( unsigned short uClientId , bool bEnabled ) = 0;

	virtual int GetCapability( unsigned short uClientId ) = 0;
	virtual const char* GetClientName( unsigned short uClientId ) = 0;

	virtual void RemoveClient( unsigned short uClientId ) = 0;

	virtual void SingleWindow( bool bEnabled) = 0;
	virtual bool SingleWindow() = 0;
	virtual void SetSingleWindowName(const char *szName) = 0;
	virtual char *GetWindowName() = 0;
	virtual IVNCDesktop* GetDesktopPointer() = 0;
	virtual void SetNewSWSize(long w,long h,bool bDesktop) = 0;
	virtual void SetSWOffset(int x,int y) = 0;
	virtual void SetScreenOffset(int x,int y,int type) = 0;

	virtual bool All_clients_initialalized() = 0;

	virtual rfb::UpdateTracker &GetUpdateTracker() = 0;
	virtual void UpdateMouse()= 0;
	virtual void UpdateClipText(const char* text) = 0;
	virtual void UpdatePalette() = 0;
	virtual void UpdateLocalFormat() = 0;

	virtual void PollUnderCursor(bool bEnable) = 0;
	virtual bool PollUnderCursor() = 0;
	virtual void PollForeground(bool bEnable) = 0;
	virtual bool PollForeground() = 0;
	virtual void PollFullScreen(bool bEnable) = 0;
	virtual bool PollFullScreen() = 0;

	virtual void Driver(bool bEnable) = 0;
	virtual bool Driver() = 0;
	virtual void Hook(bool bEnable) = 0;
	virtual bool Hook() = 0;
	virtual void Virtual(bool bEnable) = 0;
	virtual bool Virtual() = 0;
	virtual void SetHookings() = 0;

	virtual void PollConsoleOnly(bool bEnable) = 0;
	virtual bool PollConsoleOnly() = 0;
	virtual void PollOnEventOnly(bool bEnable) = 0;
	virtual bool PollOnEventOnly() = 0;

	virtual void UpdateLocalClipText( char* text) = 0;

	virtual void SetName(const char * name) = 0;
	virtual void SetPorts(const unsigned int nPort_rfb, const unsigned int nPort_http) = 0;
	virtual unsigned int GetPort() = 0;
	virtual unsigned int GetHttpPort() = 0;

	virtual void SetAutoPortSelect(const bool bAutoport) = 0;
	virtual bool AutoPortSelect() = 0;

	virtual void SetPassword(const char *passwd) = 0;
	virtual void GetPassword(char *passwd) = 0;
	virtual void EnableRemoteInputs(bool bEnable) = 0;
	virtual bool RemoteInputsEnabled() = 0;

	virtual void DisableLocalInputs(bool disable) = 0;
	virtual bool LocalInputsDisabled() = 0;

	virtual void SetConnectPriority( unsigned int priority ) = 0;
	virtual unsigned int ConnectPriority() = 0;

	virtual bool SockConnect(bool bOn) = 0;
	virtual bool SockConnected() = 0;
	virtual bool SetLoopbackOnly(bool bLoopbackOnly) = 0;
	virtual bool LoopbackOnly() = 0;

	virtual bool SetDisableTrayIcon(bool bDisableTrayIcon) = 0;
	virtual bool GetDisableTrayIcon() = 0;
	virtual bool SetAllowEditClients(bool bAllowEditClients) = 0;
	virtual bool GetAllowEditClients() = 0;

	virtual bool EnableHTTPConnect(bool enable);= 0
	virtual bool HTTPConnectEnabled() = 0;
	virtual bool EnableXDMCPConnect(bool enable) = 0;
	virtual bool XDMCPConnectEnabled() = 0;

	virtual void GetScreenInfo(int &width, int &height, int &depth) = 0;

	virtual void SetAuthRequired(bool bReqd) = 0;
	virtual bool AuthRequired() = 0;

	virtual void SetAuthHosts(const char *hostlist) = 0;
	virtual char *AuthHosts() = 0;
	virtual AcceptQueryReject VerifyHost(const char *hostname) = 0;

	virtual void AddAuthHostsBlacklist(const char *machine) = 0;
	virtual void RemAuthHostsBlacklist(const char *machine) = 0;

	virtual void SetQuerySetting(const unsigned int setting) = 0;
	virtual unsigned int QuerySetting() = 0;
	virtual void SetQueryAccept(const unsigned int setting) = 0;
	virtual unsigned int QueryAccept() = 0;
	virtual void SetQueryTimeout(const unsigned int setting) = 0;
	virtual unsigned int QueryTimeout() = 0;

	virtual void SetQueryIfNoLogon(const unsigned int setting) = 0;
	virtual bool QueryIfNoLogon() = 0;

	virtual void SetLoopbackOk(bool bOk) = 0;
	virtual bool LoopbackOk() = 0;

	virtual void SetLockSettings(int ok) = 0;
	virtual int LockSettings() = 0;

	virtual void SetAutoIdleDisconnectTimeout(const unsigned int timeout) = 0;
	virtual unsigned int AutoIdleDisconnectTimeout() = 0;

	virtual void EnableRemoveWallpaper(const bool bEnable) = 0;
	virtual bool RemoveWallpaperEnabled() = 0;


	virtual unsigned int GetDefaultScale() = 0;
	virtual bool SetDefaultScale(int nScale) = 0;
	virtual bool FileTransferEnabled() = 0;
	virtual bool EnableFileTransfer(bool bEnable) = 0;
	virtual bool BlankMonitorEnabled() = 0;
	virtual void BlankMonitorEnabled(bool bEnable) = 0;
	virtual bool MSLogonRequired() = 0;
	virtual bool RequireMSLogon(bool bEnable) = 0;
	virtual bool GetNewMSLogon() = 0;
	virtual bool SetNewMSLogon(bool bEnable) = 0;

	//virtual bool IsDSMPluginEnabled() = 0;
	//virtual void EnableDSMPlugin(bool fEnable) = 0;
	//virtual char* GetDSMPluginName() = 0;
	//virtual void SetDSMPluginName(char* szDSMPlugin) = 0;
	//virtual bool SetDSMPlugin(void) = 0;
	//virtual CDSMPlugin* GetDSMPluginPointer() = 0;

	virtual void EnableXRichCursor(bool bEnable) = 0;
	virtual bool IsXRichCursorEnabled() = 0; 

	virtual void DisableCacheForAllClients() = 0;
	virtual bool IsThereASlowClient() = 0;
	virtual bool IsThereAUltraEncodingClient() = 0;

	virtual void TurboMode(bool bEnabled) = 0;
	virtual bool TurboMode() = 0;

	virtual bool AutoReconnect() = 0;
	virtual unsigned int AutoReconnectPort()= 0;
	virtual char* AutoReconnectAdr() = 0;
	virtual char* AutoReconnectId() = 0;
	virtual void AutoReconnect(bool bEnabled) = 0;
	virtual void AutoReconnectPort(unsigned int nPort) = 0;
	virtual void AutoReconnectAdr(char* szAdr) = 0;
	virtual void AutoReconnectId(char* szId) = 0;
	virtual void AutoConnectRetry( ) = 0;

	virtual bool FTUserImpersonation() = 0;
	virtual void FTUserImpersonation(bool bEnabled) = 0;

	virtual bool CaptureAlphaBlending() = 0;
	virtual void CaptureAlphaBlending(bool bEnabled) = 0;
	virtual bool BlackAlphaBlending() = 0;
	virtual void BlackAlphaBlending(bool fEnabled) = 0;

	virtual void Clear_Update_Tracker() = 0;
	virtual void UpdateCursorShape() = 0;

	virtual bool IsClient(IVNCClient* pClient) = 0;
}

#endif